package com.sh.consumer;

import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component;

import javax.jms.TextMessage;

/**
 * @ClassName TopicConsumer
 * @Description TODO
 * @Author yaoqiang
 * @Date 2020/10/27 14:58
 * @Version 1.0
 */
@Component
public class TopicConsumer {
    @JmsListener(destination = "${mytopic}")
    public void receive(TextMessage textMessage) throws  Exception{
        System.out.println("消费者收到订阅的主题："+textMessage.getText());
    }
}
